package cn.royan.fl.requests 
{
	import cn.royan.fl.interfaces.IRequest;
	import flash.utils.Dictionary;
	import flash.utils.getTimer;
	
	/**
	 * ...
	 * @author RoYan
	 */
	public class AbstractRequest implements IRequest 
	{
		protected var packet:Object;
		protected var data:Object;
		protected var length:int;
		
		public function AbstractRequest() 
		{
			packet = { };
			data = { };
			length = 0;
		}
		
		public function encode():String
		{
			length = JSON.stringify( data ).length;
			packet["length"] = length;
			packet["data"] = data;
			packet["time"] = getTimer();
			return JSON.stringify( packet );
		}
	}

}